#ifndef __MAIN_H__
#define __MAIN_H__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
	int lineno;	// line number
	int num; 	// child number
	char* name;	// node name
	struct node *child[10];	//child node, max 10
	union{
		int INT;	
		float FLOAT;
		char* ID;
	};// value
};

typedef struct node *ParseNode;

ParseNode nodeList[1000];
int nodeNum;

int isFalse;	// determine whether the false happend, default is not

int isRoot[1000];	// seek the root node, 0 is root, 1 other
void setChild(ParseNode node);	// tag a node is 0(root) or 1(other)
ParseNode newNode(int yyline, int num, char* name, ParseNode child[]);

void preOrder(ParseNode node, int column);	// order a tree;
void printTree();	// print a parse tree from root node

void yyerror(const char *msg);

#endif